package com.lmf.webservice.service;

import com.lmf.webservice.service.wsdl.Hello;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * 创建客户端失败：二
 */
public class MainClient {
    public static void main(String[] args) throws MalformedURLException {
        //准备wsdl文件的路径地址
        URL wsdlDocumentLocation = new URL("http://127.0.0.1:8888/lmf_server?wsdl");
        //指定服务名称
        //1.namespaceURI - 命名空间地址
        //2.localPart - 服务视图名
        QName serviceName = new QName("http://webservice.lmf.com/","HelloImplService");
        //创建服务
        Service service = Service.create(wsdlDocumentLocation, serviceName);
        //获取服务实现类
        Hello port = service.getPort(Hello.class);
        String lmf = port.sayHelloWorld("lmf", 22);
        System.out.println(lmf);

    }
}
